﻿using System;
using System.Windows.Controls;
using System.Windows.Input;

namespace AIPASoft.CommonLibrary.WPF.KeyboardHook
{
    public class TextBoxKeyBoardNavigation : KeyboardFocusNavigationBase
    {
        public override void Register()
        {
            Register<TextBox>();
        }

        public override void UnRegister()
        {
            //TODO : Analyze and give proper solution
            throw new NotImplementedException();
        }

        protected override void KeyDownEvent(object sender, KeyEventArgs e)
        {
            if (e.Key != Key.Enter)
            {
                return;
            }

            if ((sender is TextBox) && (sender as TextBox).AcceptsReturn == false)
            {
                MoveToNextUIElement(e);
            }
        }
    }
}
